#include <LitStdAfx.h>
#include <LitNameGenerator.h>
#include <LitString.h>

namespace Lit
{
	NameGenerator::NameGenerator( const std::string &base, const std::string &ext, const std::string &separator ) : mBase( base ), mSep( separator ), mCounter( 0 ), mExt(ext){}
	NameGenerator::NameGenerator( const NameGenerator &nmr ) : mSep( nmr.mSep ), mCounter( nmr.mCounter ), mBase( nmr.mBase ), mExt(nmr.mExt){}

	std::string NameGenerator::peek(bool with_ext) const{ 
		return (mBase+mSep+String(mCounter).str()+(with_ext?std::string("."+mExt):std::string(""))); 
	}
	std::string NameGenerator::generate(bool with_ext){ std::string ret(peek(with_ext)); mCounter++; return ret; }
	void NameGenerator::reset(){ mCounter=0; }

	void NameGenerator::_setCount(size_t cnt ){ mCounter=cnt; }
};